#int_timer0
void ISR_Ticker(void)
{
	// This is to fine tune the interrupt to the exact number
	// of clock cycles
	//
	delay_cycles(29);
	// Reset Timer0.  (the pic does not have and automatic reload).
	//
	set_timer0(TICKRATE);

	// The actual workhorse of the interrupt is the counters used
	// elsewhere.
	//
	if(systick > 0) systick--;
	if(systick2 > 0) systick2--;

	// Finally clean up before exit.
	//
	clear_interrupt(INT_TIMER0);
}


void ServiceInterruptInit(void)
{
	// Zero countdown variables.
	//
	systick = 0;
	systick2 = 0;

	// Setup Timer 0 which will fire the interrupt.
	//
	setup_timer_0(RTCC_DIV_16 | RTCC_INTERNAL);	
	set_timer0(TICKRATE);

	// Without this part the interrupt will never fire.
	//
	enable_interrupts(INT_TIMER0);
	enable_interrupts(GLOBAL);
}


void Delay_Ticks(unsigned long int ticks)
{
	systick = ticks;
	while(systick);
}